/*
 ============================================================================
 Name		: xnetAppUi.h
 Author	  : antterminator
 Copyright   : Your copyright notice
 Description : Declares UI class for application.
 ============================================================================
 */

#ifndef __XNETAPPUI_h__
#define __XNETAPPUI_h__

// INCLUDES
#include <aknappui.h>

#include "SocketListener.h"

class CTcpSocket;

// FORWARD DECLARATIONS
class CxnetAppView;

// CLASS DECLARATION
/**
 * CxnetAppUi application UI class.
 * Interacts with the user through the UI and request message processing
 * from the handler class
 */
class CxnetAppUi: public CAknAppUi, public MSocketListener
{
public:
	// Constructors and destructor

	/**
	 * ConstructL.
	 * 2nd phase constructor.
	 */
	void ConstructL();

	/**
	 * CxnetAppUi.
	 * C++ default constructor. This needs to be public due to
	 * the way the framework constructs the AppUi
	 */
	CxnetAppUi();

	/**
	 * ~CxnetAppUi.
	 * Virtual Destructor.
	 */
	virtual ~CxnetAppUi();

public:
	// from MSocketListener
	virtual void OnResolved();
	virtual void OnConnected();
	virtual void OnDisconnected();
	virtual void OnReceived(const TDesC8& aBuffer);
	virtual void OnStateChanged(TSocketState aState);
	virtual void OnSocketError(TSocketError aError);
	
private:
	// Functions from base classes

	/**
	 * From CEikAppUi, HandleCommandL.
	 * Takes care of command handling.
	 * @param aCommand Command to be handled.
	 */
	void HandleCommandL(TInt aCommand);

	/**
	 *  HandleStatusPaneSizeChange.
	 *  Called by the framework when the application status pane
	 *  size is changed.
	 */
	void HandleStatusPaneSizeChange();


private:
	// Data

	/**
	 * The application view
	 * Owned by CxnetAppUi
	 */
	CxnetAppView* iAppView;
	CTcpSocket* iTcpSocket;
};

#endif // __XNETAPPUI_h__
// End of File
